import request from "@/util/http";
import qs from "qs";

export default {
  gain(forms) {
    return request({
      method: "get",
      params: {
        _gp: "admin.recommend",
        _mt: "queryRecommendByType",
        recommendType: forms.recom,
        pageNo: forms.pageNo,
        limit: forms.pageSize
      }
    });
  },
  //新增
  adduser(form, goods) {
    return request({
      method: "post",
      data: qs.stringify({
        _gp: "admin.recommend",
        _mt: "addRecommend",
        recommendType: form.type,
        spuId: goods
      })
    });
  },
  //删除接口
  cancel(form) {
    return request({
      method: "post",
      data: qs.stringify({
        _gp: "admin.recommend",
        _mt: "deleteRecommend",
        recommendType: form.type,
        id: form.id
      })
    });
  },
  //获取SPU树
  spu() {
    return request({
      method: "get",
      params: {
        _gp: "admin.goods",
        _mt: "getSpuBigTree"
      }
    });
  }
};
